<?php
namespace app\index\controller;
use think\Controller;
use think\Db;

class Index extends Controller
{
    public function index()
    {	 
    	$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
        //$query = new \think\db\Query();
		/*$img=$query->table('dsc_goods')->where("goods_thumb != '' and goods_img != '' and original_img != '' ")->column('goods_id,goods_name,goods_thumb,goods_img,original_img,goods_desc');*/
		//$img=$query->table('dsc_goods')->column('goods_id,goods_name,goods_thumb,goods_img,original_img,goods_desc');
    	//var_dump($img);
    	$img=Db::query('select * from dsc_goods');
    	//dump($img);
    	foreach ($img as $idx => $row) {
    		$img[$idx]['goods_id'] = $row['goods_id'];
    		$img[$idx]['goods_name'] = $row['goods_name'];
    		$img[$idx]['goods_thumb'] = $row['goods_thumb'];
    		$img[$idx]['goods_img'] = $row['goods_img'];
    		$img[$idx]['original_img']	= $row['original_img'];
    		//$img[$idx]['goods_desc']          = strip_tags($row['goods_desc']);
    		/*$img[$idx]['goods_desc']          = str_replace("none;","",str_replace(":","",str_replace("float","",str_replace('"',"",str_replace("src=","",str_replace('style=','',str_replace("/>",",",str_replace("<br/>","",str_replace("<img","",str_replace("</br>","",str_replace("</p>","",str_replace("<p>","",$row['goods_desc']))))))))))));*/
    		//$img[$idx]['goods_desc'] = $row['goods_desc'];
    		
    		//已经去掉了P标签
    		//str_replace("</p>","",str_replace("<p>","",$row['goods_desc']));
    		//str_replace("</br>","",str_replace("</p>","",str_replace("<p>","",$row['goods_desc'])));
    	}
    	$this->assign('img',$img);
        return $this->fetch('goods_res');
    }
}
